package com.zhongshengnetwork.rightbe.dbservice;

import com.zhongshengnetwork.rightbe.CustomApplication;
import com.zhongshengnetwork.rightbe.dbmodel.UserInfodbModel;
import com.zhongshengnetwork.rightbe.dbmodel.VersiondbModel;

import org.xutils.DbManager;
import org.xutils.ex.DbException;
import org.xutils.x;

/**
 * Created by zhongsheng-luojianlan on 17/4/13.
 */

public class VersiondbService {
    //插入或者更新数据
    public static boolean saveOrUpdate(VersiondbModel model){
        DbManager db = x.getDb(CustomApplication.daoConfig);
        try {
            db.saveOrUpdate(model);
            return true;
        } catch (DbException e) {
            e.printStackTrace();
            return false;
        }
    }

    /**
     * @return
     */
    //查找数据
    public static VersiondbModel getVersiondbModel(String version){
        DbManager db = x.getDb(CustomApplication.daoConfig);
        try {
            VersiondbModel model = db.findById(VersiondbModel.class,version);
            return model;
        } catch (DbException e) {
            e.printStackTrace();
            return null;
        }
    }
}
